import es_factory from './elasticsearch_factory';
const orm = require('elasticsearch-orm');
const redisConfig = require('../config/elasticsearch.config.json');

let config = process.env.NODE_ENV == 'production' ? redisConfig.production : redisConfig.development;

let esConn = null;

async function loadEslDb() {
    esConn = await es_factory(config);
    return esConn;
}

function getEsDb(){
    return esConn;
}

export {loadEslDb, getEsDb};